﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LearnThemselvesEffectively.Classes
{
    class ExamCore : TranslationCore
    {
        #region Fields and properties
        private PersistantLayerXML moPersistantLayer;

        #endregion
        
        public ExamCore(int StageNo)
        {
            moPersistantLayer = new PersistantLayerXML();
            WordsInStage = moPersistantLayer.RetrieveAllTranslateItemsInStage(StageNo);
        }

        /// <summary>
        /// Next word in test
        /// </summary>
        public override void NextWord()
        {
            int iIndexOfNext = WordsInStage.IndexOf(CurrTranstationItem) + 1;
            if (iIndexOfNext == WordsInStage.Count || iIndexOfNext == 0)   //iIndexOfNext == 0 becouse if WordsInStage.IndexOf(CurrTranstationItem) == -1
            {
                GlobalSupportModele.SessionState = GlobalSupportModele.eSessionState.Finished;
                return;
            }
            CurrentWordID = WordsInStage[iIndexOfNext].ID;
        }
    }
}
